package com.hzsoft.base;

import javax.servlet.http.HttpServletRequest;

import com.hzsoft.sys.entity.SysUser;
import com.hzsoft.util.Const;


public class BaseController {

	public String getRemoteIp(HttpServletRequest request){
		if (request.getHeader("x-forwarded-for") == null) 
			return request.getRemoteAddr();
		return request.getHeader("x-forwarded-for");
	}
	
	public String getUsercode(HttpServletRequest request){
		if(null!=request.getSession().getAttribute(Const.SESSION_USER))
			return ((SysUser)request.getSession().getAttribute(Const.SESSION_USER)).getName();
		return "unknow user";
	}
	
}
